package recite.word.service.base.common.enums;

import lombok.Getter;

import java.util.Optional;
import java.util.stream.Stream;

@Getter
public enum DayCompleteEnum {
    COMPLETE(1,"完成"),
    NO_COMPLETE(2,"未完成"),
    ;

    private Integer type;
    private String desc;

    DayCompleteEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static DayCompleteEnum getByType(Integer type){
        return Optional.ofNullable(type)
                .map(paramType -> Stream.of(values()).filter(item -> item.getType().equals(paramType)).findAny().orElse(null))
                .orElse(null);
    }
}
